package com.max.xihu.collection;

import java.math.BigDecimal;

/**
 * @Author: Max
 * @Date: 2020-07-09 17:41
 * @Description:
 */
public class DoubleTest {

    public static void main(String[] args) {

        Double d1 = new Double(4.7);
        Double d2 = new Double("4.6");
        BigDecimal bd = new BigDecimal(d1);
        bd.setScale(1,BigDecimal.ROUND_DOWN);
        System.out.println(bd.doubleValue());
        int i = d1.compareTo(d2);
        System.out.println(i);


        String strD = String.valueOf(d1*10);
        String[] strArr = strD.split("\\.");

        System.out.println(Double.parseDouble(strArr[0])/10);
    }
}
